fix(test): match Go output buffering and JSON streaming - #2724
Merged
xushiwei merged 4 commits intoOct 4, 2026
Merged
Conversation
Contributor
There was a problem hiding this comment.
Review: Go-compatible test output
Solid, well-tested rework. The new testOutputPolicy cleanly mirrors cmd/go's local-directory vs. package-list output modes, the test2json converter is a faithful upstream vendor with correct BSD attribution/LICENSE, and the package-ordered reporter is covered by targeted tests. I specifically investigated the main risk and found it not present:
- No data race in
testResultReporter. The stateful closure (results/ready/next) is only ever touched on the serialized scheduler goroutine. Intest_dag.go,report(...)is invoked only fromskipped/blocked/complete, all of which run on the single main loop; worker goroutines only runrun, andrunResults[rootIndex]is ordered through the completion channel (happens-before). Inrun.gorunTestPrograms,reportis called only from the collection loop. Writes to the shared stdout are serialized vialockedTestWriter. - Correctness verified:
testJSONArgsnormalization (stops at--, no caller-slice mutation, no duplicate-test.v), thebuild.goemulator-test refactor (compile-only path still no-ops viarunInEmulator; executed emulator tests now join the batch), the\x16FAIL-line prefix being consumed only inside a converter, and injection-safeexec.Commandarg passing.
Notes (non-blocking)
- One inline comment below: a wasted full-output buffer copy in JSON mode (the only concrete issue in the PR's own new code).
- Memory characteristic (informational): in buffered/package-ordered mode, output of completed-but-not-yet-flushed packages stays resident until the head-of-line package finishes. This matches
cmd/goin-order printing semantics, so it's by design — just worth awareness under skewed package durations with large output. internal/test2json/test2json.gocarries two inaccurate doc annotations copied verbatim from upstream Go: theNewConvertercomment says framing is prefixed with^V (\x22)(should be\x16) and references aModeTimeconstant that is actually namedTimestamp. Comment-only, no behavioral impact; left to you whether to diverge from upstream for a faithful-vendor sync.
No blocking issues.
Codecov Report❌ Patch coverage is
📢 Thoughts on this report? Let us know! |
LLGo WebAssembly build benchmarks
WebAssembly output sizes
LLGo WebAssembly build measurements
Compared with |
LLGo baseline benchmarks
Program measurements
Core language and compiler benchmarks
Timer runtime benchmarks
Compared with |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Align
llgo testoutput buffering and streaming withgo test.go testllgo test-v ./pkg(one package)=== RUNand earlier logs remain visible-v -p=1 ./...-v ./...(multiple packages in parallel)-json ./...-v/-json/-bench/-fuzz-bench/-fuzz-list-p=1; otherwise buffer per package-timeout0disables the test timeout-timeout=0may leave them hidden indefinitelySingle-package output follows the same Go policy:
go test)llgo test(no package argument)t.Logneeds-vllgo test ./pkgllgo test -v ./pkg=== RUNand earlier logs remain visiblellgo test -json ./pkg